import request from '@/config/axios'

// 自定义盈利能力监控 VO
export interface ProfitMonitorVO {
  id: number // 主键
  days: number // 监控周期
  type: string // 监控类型
  vaue: number // 设置值
  enabled: number // 启用状态
  deptId: number // 部门id
}

// 自定义盈利能力监控 API
export const ProfitMonitorApi = {
  // 查询自定义盈利能力监控分页
  getProfitMonitorPage: async (params: any) => {
    return await request.get({ url: `/erp/profit-monitor/page`, params })
  },

  // 查询自定义盈利能力监控详情
  getProfitMonitor: async (id: number) => {
    return await request.get({ url: `/erp/profit-monitor/get?id=` + id })
  },

  // 新增自定义盈利能力监控
  createProfitMonitor: async (data: ProfitMonitorVO) => {
    return await request.post({ url: `/erp/profit-monitor/create`, data })
  },

  // 修改自定义盈利能力监控
  updateProfitMonitor: async (data: ProfitMonitorVO) => {
    return await request.put({ url: `/erp/profit-monitor/update`, data })
  },

  // 删除自定义盈利能力监控
  deleteProfitMonitor: async (id: number) => {
    return await request.delete({ url: `/erp/profit-monitor/delete?id=` + id })
  },

  // 导出自定义盈利能力监控 Excel
  exportProfitMonitor: async (params) => {
    return await request.download({ url: `/erp/profit-monitor/export-excel`, params })
  },

  // 触发
  triggerProfitMonitor: async (id: number) => {
    return await request.post({ url: `/erp/profit-monitor/trigger?id=` + id })
  },
}
